import numpy as np

# 像素坐标系到图像坐标系的转换
def pixel_to_image(pixel_x, pixel_y, u0, v0, dx, dy):
    image_x = pixel_x * dx + u0
    image_y = v0 - pixel_y * dy
    return image_x, image_y

# 图像坐标系到相机坐标系的转换
def image_to_camera(image_x, image_y, u0, v0, dx, dy, f):
    camera_x = (image_x - u0) * dx * f
    camera_y = (v0 - image_y) * dy * f
    return camera_x, camera_y

# 示例使用
pixel_x = 100
pixel_y = 200
u0 = 320
v0 = 240
dx = 0.002
dy = 0.002
f = 0.01  # 假设焦距为10mm

image_x, image_y = pixel_to_image(pixel_x, pixel_y, u0, v0, dx, dy)
camera_x, camera_y = image_to_camera(image_x, image_y, u0, v0, dx, dy, f)

print("像素坐标系：", pixel_x, pixel_y)
print("图像坐标系：", image_x, image_y)
print("相机坐标系：", camera_x, camera_y)